<template>
    <input type="text" v-model="username" />
    {{ username }}
    <br />
    <button @click="ClickMe">绑定事件</button>

 
    {{ count }}
   
    <input type="text" value="张三" ref="hello" />

</template>

<script setup>
    import {ref,computed,watch,onMounted} from 'vue'

    let username = ref('')

    function ClickMe(){
        alert('触发事件')
    }

    let count = computed(() => {
        var num = 150.417
        return num.toFixed(2)
    })

    watch(username, (newValue,oldVal) => {
        console.log(newValue,oldVal)
    })

    const hello = ref(null)

    onMounted(() => {
        console.log(hello.value)
        console.log(hello.value.value)
    })
</script>